<template>
    <view class="tui-safe-area">
        <view class="tui-address">
            <!-- <block v-for="(item,index) in dataList" :key="index">
                <tui-list-cell padding="0">
                    <view class="tui-address-flex" style="position: relative;">
                        <view :data-id="item.id" class="tui-address-left">
                            <view class="tui-address-main">
                                <view class="tui-address-name">{{item.title}}</view>
                            </view>
                            <view class="tui-address-detail">
                                <text>手机号码：{{item.tel}}</text>
                                <text style="font-size: 14px;position:absolute;color: green;right: 68px;" @tap="navigateTo('/pages/technical/details?id=' + item.id)">详情</text>
                                <text style="font-size: 14px;position: absolute;color: red;right: 20px;" @tap="selectTap(item.id)">选择</text>
                                <checkbox color="#fff"></checkbox>

                            </view>

                        </view>
                    </view>
                </tui-list-cell>
            </block> -->
            <checkbox-group @change="selectChange">
                <view class="tui-cart-cell  tui-mtop" v-for="(item, index) in dataList" :key="index">
                    <tui-swipe-action :actions="actions" @click="delItem" :params="item">
                        <template v-slot:content>
                            <view class="tui-goods-item">
                                <label class="tui-checkbox">
                                    <checkbox :value="item.id" :data-id="index" :checked="item.active" color="#fff">
                                    </checkbox>
                                </label>
                                <image :src="item.touxiang" class="tui-goods-img" />
                                <view class="tui-goods-info">
                                    <view class="tui-goods-title">
                                        {{ item.title }}
                                    </view>
                                    <view class="tui-price-box">
                                        <view class="tui-goods-price">手机号码：{{ item.tel }}</view>
                                        <text style="font-size: 14px;color: green;" @tap="navigateTo('/pages/technical/details?id=' + item.id)">详情</text>
                                    </view>
                                </view>
                            </view>
                        </template>
                    </tui-swipe-action>
                </view>
            </checkbox-group>
        </view>
        <view class="tui-btn-box" style="padding: 0 45px;">
            <tui-button :disabledGray="true" height="86rpx" type="danger" @click="selectTap" shape="circle">确定
            </tui-button>
        </view>
    </view>
</template>
 
<script>
export default {
    data() {
        return {
            dataList: [],
            sid: 0,
            order_tid: []
        }
    },
    onLoad: function (options) {
        this.sid = options.sid || 0;
        this.initdataList();
    },
    onShow: function () {

    },
    methods: {
        selectChange: function (e) {
            this.order_tid = e.detail.value;
            console.log(this.order_tid)
        },
        navigateTo(url) {

            uni.navigateTo({
                url: url
            });
        },
        selectTap: function (id) {
            if(this.order_tid.length == 0){
                uni.showToast({
                    title: '请选择师傅',
                    icon: 'none'
                })
                return;
            }
            uni.setStorageSync('order_tid', this.order_tid);
            uni.navigateBack({});
        },
        initdataList: function () {
            var _this = this;
            _this.$request.post('technical.list', {
                samkey: (new Date()).valueOf(),
                sid: _this.sid
            }).then(res => {
                if (res.errno == 0) {
                    _this.dataList = res.data.data;
                } else if (res.errno == 700) {
                    _this.dataList = null;
                }
            })
        }
    }
}
</script>

<style>
.tui-address {
    width: 100%;
    padding-top: 20rpx;
    padding-bottom: 160rpx;
}

.tui-address-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tui-address-main {
    width: 600rpx;
    height: 70rpx;
    display: flex;
    font-size: 30rpx;
    line-height: 86rpx;
    padding-left: 30rpx;
}

.tui-address-name {
    height: 60rpx;
    font-weight: bold;
}

.tui-address-tel {
    margin-left: 12rpx;
}

.tui-address-detail {
    font-size: 24rpx;
    word-break: break-all;
    padding-bottom: 25rpx;
    padding-left: 25rpx;
    padding-right: 120rpx;
}

.tui-address-label {
    padding: 5rpx 8rpx;
    flex-shrink: 0;
    background: #e41f19;
    border-radius: 6rpx;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 25rpx;
    line-height: 25rpx;
    transform: scale(0.8);
    transform-origin: center center;
    margin-right: 6rpx;
}

.tui-address-imgbox {
    width: 80rpx;
    height: 100rpx;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    right: 10rpx;
}

.tui-address-img {
    width: 36rpx;
    height: 36rpx;
}

.tui-address-new {
    width: 100%;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 999;
    padding: 20rpx 25rpx 30rpx;
    box-sizing: border-box;
    background: #fafafa;
}

.tui-safe-area {
    padding-bottom: env(safe-area-inset-bottom);
}
.tui-cart-cell {
    width: 100%;
    border-radius: 12rpx;
    background: #ffffff;
    padding: 40rpx 0;
    overflow: hidden;
}

.tui-goods-item {
    display: flex;
    padding: 0 30rpx;
    box-sizing: border-box;
}

.tui-checkbox {
    min-width: 70rpx;
    display: flex;
    align-items: center;
}

/* #ifdef MP-WEIXIN */
.tui-checkbox .wx-checkbox-input {
    width: 40rpx;
    height: 40rpx;
    margin-right: 0 !important;
    border-radius: 50% !important;
    transform: scale(0.8);
    border-color: #d1d1d1 !important;
}

.tui-checkbox .wx-checkbox-input.wx-checkbox-input-checked {
    background: #eb0909;
    width: 44rpx !important;
    height: 44rpx !important;
    border: none;
}

/* #endif */
/* #ifndef MP-WEIXIN */

>>> .tui-checkbox .uni-checkbox-input {
    width: 40rpx;
    height: 40rpx;
    margin-right: 0 !important;
    border-radius: 50% !important;
    transform: scale(0.8);
    border-color: #d1d1d1 !important;
}

>>> .tui-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
    background: #eb0909;
    width: 45rpx !important;
    height: 45rpx !important;
    border: none;
}
.tui-goods-img {
    width: 100rpx;
    height: 100rpx !important;
    border-radius: 12rpx;
    flex-shrink: 0;
    display: block;
}

.tui-goods-info {
    width: 100%;
    padding-left: 20rpx;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    box-sizing: border-box;
    overflow: hidden;
}

.tui-goods-title {
    white-space: normal;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 24rpx;
    color: #333;
}

.tui-goods-model {
    max-width: 100%;
    color: #333;
    background: #f5f5f5;
    border-radius: 40rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16rpx;
    box-sizing: border-box;
}

.tui-model-text {
    max-width: 100%;
    transform: scale(0.9);
    transform-origin: 0 center;
    font-size: 24rpx;
    line-height: 32rpx;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tui-price-box {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.tui-goods-price {
    font-size: 24rpx;
    font-weight: 500;
    /* color: #e41f19; */
}
</style>
